import React, { Component } from 'react';
import { Route, Link } from "react-router-dom";

class Form extends Component {

    componentWillMount() {
      console.log(this.props.routes)
    }

    render() { 
        let {match, routes} = this.props;
        return ( 
            <div className="form-box">
              <div className="left">
                  <Link to={`${match.path}/form1`}>Form1</Link>
                    <br/>
                  <Link to={`${match.path}/form2`}>Form2</Link>
              </div>
              <div className="right">
                  {
                      routes.map((item,key) => {
                          return <Route 
                                      key={key} 
                                      path={item.path} 
                                      component={item.component}
                                 />
                      })
                  }
              </div>
              
            </div>
         );
    }
}
 
export default Form;